package com.nantong.common.core.enums.commonEnums;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 报价单状态枚举
 *
 * @author nantong
 */
@Getter
@AllArgsConstructor
public enum QuoteStatusEnum {
    DRAFT(1, "草稿"),
    PENDING_REVIEW(2, "待审核"),
    RECEIVED(3, "已接收"),
    REJECTED(4, "已拒绝");

    @JsonValue
    private final Integer code;
    private final String desc;

    public static QuoteStatusEnum fromCode(Integer code) {
        for (QuoteStatusEnum value : QuoteStatusEnum.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
}